<?php
namespace App\Models\Chain\PointCash;



use App\Constants\CashConstant;
use App\Constants\CreditLogConstant;
use App\Models\Factory\CashFactory;
use App\Models\Factory\IdentityCreditFactory;
use App\Models\Factory\InviteFactory;
use App\Models\Chain\AbstractHandler;
use App\Strategies\PointStrategy;

/**
 * 插入现金流水表
 * Class CreateCreditLogAction
 * @package App\Models\Chain\Identity
 */

class CreateUserAccountLogAction extends AbstractHandler
{
    private $params = array();

    protected $error = array('error' => '插入现金流水失败', 'code' => 7011);


    public function __construct($params)
    {
        $this->params = $params;
    }

    public function handleRequest()
    {
        if ($this->createUserAccountLog($this->params) == true) {
            $this->setSuccessor(new UpdateUserAccountAction($this->params));
            return $this->getSuccessor()->handleRequest();
        } else {
            return $this->error;
        }
    }


    public function createUserAccountLog($params)
    {

        $result = CashFactory::createAccountLog($params);
        return $result;
    }


}